home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
programming
/
other
/
gui4cli
/
docs
/
tutorials
/
clipview.gc
< prev
next >
Wrap
Text File
|
1999-05-14
|
2KB
|
100 lines
G4C
; ClipView.gc
; --------------------------------------------------------
; How to use the ClipBoard capabilities.
; This gui will show you whatever is in the given
; clipboard unit. Also you can load/save clips.
; A more advanced version is guis:g4c/ced/cedclip.g
; --------------------------------------------------------
WINBIG 110 40 437 169 'Clipboard Viewer'
WinType 11110001
xOnLoad
unit = 0 ; our default clipboard unit
GuiOpen ClipView.gc
xOnClose
GuiQuit ClipView.gc
BOX 0 0 437 20 OUT ICONDROP
; --------------------------------------------------------
; Change the clipboard unit
; --------------------------------------------------------
XBUTTON 401 4 30 12 ">>"
++unit
gosub clipview.gc changeunit
XBUTTON 302 4 30 12 "<<"
--unit
gosub clipview.gc changeunit
XTEXTIN 338 3 58 14 "" unit '0' 10
gadid 2
gosub clipview.gc changeunit
xRoutine ChangeUnit
; make sure the unit is 0-255
if $unit > 255
unit = 0
elseif $unit < 0
unit = 255
endif
; load the given clip..
lvuse clipview.gc 1
lvchange "CLIPS:$unit"
update clipview.gc 2 $unit
; --------------------------------------------------------
; Load a file into the current clipboard unit
; --------------------------------------------------------
XBUTTON 7 4 80 12 "Load.."
ReqFile -1 -1 300 -30 'Choose file :' LOAD filename ''
if $filename > ''
lvuse clipview.gc 1
lvchange $filename
; now save it so as to write it to the clipboard
lvsave 'CLIPS:$unit'
endif
; --------------------------------------------------------
; Save the current clipboard unit as a file
; --------------------------------------------------------
XBUTTON 88 4 80 12 "Save.."
ReqFile -1 -1 300 -30 'Save as file :' SAVE savename ''
if $savename > ' '
ifexists file $savename
ezreq 'File $savename exists.\nOverwrite ?' Overwrite|CANCEL choice
if $choice = 0
stop
endif
endif
lvsave $savename
endif
; --------------------------------------------------------
; Clear the current clipboard unit
; --------------------------------------------------------
XBUTTON 169 4 80 12 "Clear"
lvuse clipview.gc 1
lvclear
; update the clipboard
lvsave 'CLIPS:$unit'
; --------------------------------------------------------
; The listview
; --------------------------------------------------------
XLISTVIEW 0 20 436 148 "" clipline CLIPS:0 10 NUM
gadid 1